import {ipConfig} from "../ip-map-config";
import {tryHideFullScreenLoading} from "./loading";
import {MessageError} from "../custom/message";

const messageErrorHint = _.debounce((error, message) => {
    let msg = message
    tryHideFullScreenLoading()
    if (error && error.data) {
        msg = error.data.message
        location.href = error.data.code === -9 && ipConfig.homepageIp() + '/#login'
    }
    MessageError(msg, 2000)
}, 300)

export default messageErrorHint
